package com.haidong.web;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/req5")
public class RequestDemo5 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //接受请求的同时,解读出转发者的消息
        //虽然请求转发了,但是客户端的请求只有一次,地址栏也不会跳转到新servlet
        //请求转发只发生在后台
        Object msg = req.getAttribute("msg");
        System.out.println(msg);
        System.out.println("接收到请求5");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
